Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAI-22855 fix issues with (u)int128 within value types #102

Merged
merged 11 commits into from
Mar 22, 2024
Merged

Conversation

wienleung
Copy link
Contributor

@wienleung wienleung commented Mar 15, 2024

Handle the case where there are composite values (i.e. large values represented by multiple arrow columns) within value types.

@wiz-inc-7643e85288
Copy link

wiz-inc-7643e85288 bot commented Mar 15, 2024

Wiz Scan Summary

IaC Misconfigurations 0C 0H 0M 0L 0I
Vulnerabilities 0C 0H 0M 0L 0I
Sensitive Data 0C 0H 0M 0L 0I
Total 0C 0H 0M 0L 0I
Secrets 0🔑

@vilterp vilterp self-requested a review March 15, 2024 22:27
@vilterp
Copy link
Contributor

vilterp commented Mar 15, 2024

Thanks for this PR @wienleung 🙏

I want to just approve so we can move on with our lives, but I'm wondering why the JS SDK is able to get away with code for debugging value types that appears to be so much simpler: https://github.com/RelationalAI/rai-sdk-javascript/blob/3457821ebdd6d6a01ec328b39b37226bd9dff713/src/results/resultUtils.ts#L252-L273

Seems like they're factored differently — in the JS SDK, ResultTable has an arrow table and some metadata as class members, and passes the appropriate bits into convertValue. In the Go SDK, the path is a little more indirect — it creates Columns from the raw arrow data (without looking at the proto metadata), and Partitions wrapping them, before looking at the metadata and converting those Columns into Relations.

I'd love to simplify this, but it seems like a bigger refactor than we have bandwidth for right now, so maybe let's just go for it.

@NHDaly does this sound right to you?

@wienleung
Copy link
Contributor Author

wienleung commented Mar 16, 2024

Honestly IDK. Somehow the Go version has to deal with arrays of lists and structs from the unmarshalled Arrow types and struct, and that doesn't seem to be the case for the JS version (at least from a quick look), which seems to happily yank values out of the Arrow table and convert them thru that function you linked

@vilterp vilterp marked this pull request as ready for review March 16, 2024 03:43
Copy link
Contributor

@vilterp vilterp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk either. But this has good test coverage and comments (thanks for those) so let's go for it.

A couple naming questions; feel free to take or leave.

I can release this once you merge.

@@ -431,6 +448,58 @@ func (c listItemColumn[T]) Value(rnum int) any {
return c.Item(rnum)
}

// Represents several sub-columns of a `listColumn` that represent one column for a composite type (e.g. int128)
type listSliceColumn[T any] struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this what we were calling compositeColumn on our call? I think I liked that name a bit better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't call it that because this isn't the only way values made by composing primitive types together are stored as columns. Not a good general preference, but here I think we should be clear about how the struct works vs what user-level functionality it's intended for, given the complexity of all the various "column" transformations going on

@vilterp vilterp merged commit 4614e6d into main Mar 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants